package net.kelissa.jenetic.impl.conceiver;

import java.util.ArrayList;
import java.util.List;

import net.kelissa.jenetic.Conceiver;
import net.kelissa.jenetic.Gene;
import net.kelissa.jenetic.RandomUtil;

public class ConceiverShuffleRandom implements Conceiver
{

  @Override
  public List<Gene> conceive(List<Gene> mother, List<Gene> father)
  {
    List<Gene> clone = new ArrayList<Gene>();
    for (int i = 0; i < mother.size(); i++)
    {
      double rand = RandomUtil.getRandom().nextDouble();
      if (rand < 0.5)
        clone.add(mother.get(i).clone());
      else
        clone.add(father.get(i).clone());
    }
    return clone;
  }

}
